import { View } from "../../../mvc/core/View";
import { EPrictUnit } from "../../../../Message/Public/EPrictUnit";
import { RadioButtonGroup } from "../../../../fl/controls/RadioButtonGroup";
import { ObjCreate } from "../common/ObjCreate";
import { GlobalClass } from "../../../../com/mui/core/GlobalClass";
import { ImagesConst } from "../../resource/ImagesConst";
import { GRadioButton } from "../../../../com/mui/controls/GRadioButton";
import { DataEvent } from "../../events/DataEvent";
import { EventName } from "../../mvc/EventName";
import { RadioButton } from "../../../../fl/controls/RadioButton";
import { _EPriceUnitCoin } from "../../../../EPrictUnit/_EPriceUnitCoin";
import { _EPriceUnitGold } from "../../../../EPrictUnit/_EPriceUnitGold";
//class MoneySelectPanel
    
    export  class MoneySelectPanel extends View
    {
        constructor()
        {
            this._dataArr = [{"name":"", "unit": _EPriceUnitCoin}, {"name":"", "unit": _EPriceUnitGold}];
            this._radioBtnArr = [];
            super();
            this.init();
            return;
        }

        /* internal  */init(): void
        {
            var loc2=null;
            var loc7=null;
            var loc1=new RadioButtonGroup("rbg");
            var loc3=0;
            var loc4=0;
            var loc5=0;
            while (loc5 < 2) 
            {
                loc2 = ObjCreate.createRadioButton(this._dataArr[loc5].name, loc3, loc4, 80, 30, this, "GRadioButtonBig");
                loc2.addEventListener(flash.events.MouseEvent.CLICK, this.onRadioBtnClickHandler);
                loc2.value = this._dataArr[loc5].unit;
                loc2.group = loc1;
                loc4 = loc4 + 20;
                this._radioBtnArr.push(loc2);
                ++loc5;
            }
            var loc6;
            (loc6 = GlobalClass.getBitmap(ImagesConst.Tongqian)).x = 20;
            loc6.y = 5;
            addChild(loc6);
            (loc7 = GlobalClass.getBitmap(ImagesConst.Yuanbao)).x = 20;
            loc7.y = 25;
            addChild(loc7);
            return;
        }

        /* internal  */onRadioBtnClickHandler(arg1: Object /* flash.events.MouseEvent */): void
        {
            var loc1=arg1.target as GRadioButton;
            dispatchEvent(new DataEvent(EventName.MarketMoneyTypeChange, loc1.value));
            return;
        }

        public resetSelecter(): void
        {
            (this._radioBtnArr[0] as RadioButton).selected = false;
            (this._radioBtnArr[1] as RadioButton).selected = false;
            return;
        }

        public setFirstSelected(): void
        {
            (this._radioBtnArr[0] as RadioButton).selected = true;
            return;
        }

        /* internal */ /* var */_dataArr: Array<any>;

        /* internal */ /* var */_radioBtnArr: Array<any>;
    }
